package com.liukai.novel_commons.utils;

import android.content.Intent;
import android.os.Environment;

import com.liukai.novel_commons.entities.NovelChapter;
import com.liukai.novel_commons.entities.NovelInfo;
import com.liukai.novel_commons.entities.NovelRack;
import com.liukai.novel_commons.entities.UserInfo;

import java.util.ArrayList;
import java.util.List;

public class Constans {


    public static final String BASE_URL = "http://192.168.43.121:";

    public static final String NOVEL_BASE_URL = BASE_URL + "8001";
    public static final String USER_BASE_URL = BASE_URL + "8010";
    public static final String RACK_BASE_URL = BASE_URL + "8030";
    public static final String IMAGE_BASE_URL = BASE_URL + "8001/image/";


    public static final int CODE_REQUEST_MyInfoFragment = 1001;
    public static final int CODE_RESULT_LoginActivity = 1002;
    public static final int CODE_RESULT_SettingActivity = 1003;
    public static final int CODE_REQUEST_NovelRackFragment = 1004;
    public static final int CODE_RESULT_ReadActivity = 1005;


    public static final String FILE_PATH = Environment.getExternalStorageDirectory() + "/liukai10/";


    public static final String LOGOUT = "退出登录";

    private static UserInfo userInfo = new UserInfo();
    private static NovelInfo sNovelInfo;

    public static void setUserInfo(UserInfo userInfo) {
        Constans.userInfo = userInfo;
    }

    public static UserInfo getUserInfo() {
        return userInfo;
    }

    // 书架信息
    private static List<NovelRack> sNovelRackList = new ArrayList<>();

    // 更新书架
    public static void setNovelRackList(List<NovelRack> novelRackList) {
        sNovelRackList.clear();
        sNovelRackList.addAll(novelRackList);
    }

    // 获取书架
    public static List<NovelRack> getNovelRackList() {
        return sNovelRackList;
    }

    // 添加书架
    public static void addNovelRackList(NovelRack novelRack) {
        sNovelRackList.add(novelRack);
    }

    /**
     * 小说章节
     */
    private static List<NovelChapter> muluChapter = new ArrayList<>();

    public static void setMuluChapter(List<NovelChapter> muluChapter1) {
        muluChapter.clear();
        muluChapter.addAll(muluChapter1);
    }

    public static List<NovelChapter> getMuluChapter() {
        return muluChapter;
    }


    /**
     * 热门搜索
     */
    private static List<NovelInfo> hotNovel = new ArrayList<>();

    public static List<NovelInfo> getHotNovel() {
        return hotNovel;
    }

    /**
     * 搜索历史
     */
    private static List<NovelInfo> historyNovelList = new ArrayList<>();

    public static List<NovelInfo> getHistoryNovelList() {
        return historyNovelList;
    }

    static {
        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("神医女帝").setNovelId("6814f6beb211452f8795d8173692f680");
        hotNovel.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("大主宰").setNovelId("d809c4252ea549868b28706428486a30");
        hotNovel.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("圣樱学院：王子的专属甜心").setNovelId("6f98b56fcb844aacacf0bb3bb87b5d01");
        hotNovel.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("我在漫威当大佬").setNovelId("442df6a8ef1549c3a5a807d0873627a2");
        hotNovel.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("魂逆九天之天命神女").setNovelId("32c18f62e4fe468292a455c74b3a109c");
        hotNovel.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("末世红警").setNovelId("11d366f5969643608842ce713af5617f");
        hotNovel.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("神秘豪婚：老公轻点宠").setNovelId("65e8489e9b3e41369b0f18cb151da8cf");
        hotNovel.add(sNovelInfo);


        /**
         * 搜索历史
         */
        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("圣樱学院：王子的专属甜心").setNovelId("6f98b56fcb844aacacf0bb3bb87b5d01");
        historyNovelList.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("大主宰").setNovelId("d809c4252ea549868b28706428486a30");
        historyNovelList.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("末世红警").setNovelId("11d366f5969643608842ce713af5617f");
        historyNovelList.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("神秘豪婚：老公轻点宠").setNovelId("65e8489e9b3e41369b0f18cb151da8cf");
        historyNovelList.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("我在漫威当大佬").setNovelId("442df6a8ef1549c3a5a807d0873627a2");
        historyNovelList.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("魂逆九天之天命神女").setNovelId("32c18f62e4fe468292a455c74b3a109c");
        historyNovelList.add(sNovelInfo);

        sNovelInfo = new NovelInfo();
        sNovelInfo.setNovelName("神医女帝").setNovelId("6814f6beb211452f8795d8173692f680");
        historyNovelList.add(sNovelInfo);


    }


}
